$(function(){

    $("input[name='money']").val('价格:'+localStorage.place+'元')
    $("#examination_adress").val(localStorage.school_address);
    $("#money_model").val(localStorage.sign_type_name);


    var state = false;
    $(".agreement_sure").click(function() {
        if($(".gouxuan").eq(0).css("display") == "block") {
            $(".gouxuan").eq(0).css("display","none");
            state=true;
        }else{
            $(".gouxuan").eq(0).css("display","block");
        }
    });


    /*电话咨询*/
    //  console.log(localStorage.man_phone);
    $("#phone_cal").click(function() {
        window.location.href='tel://"+ localStorage.man_phone+"';

    });

    /*确认提交*/
    $("#sure_baoming").click(function() {
        /*计费方式*/
        localStorage.money_model = $("#money_model").val();
        localStorage.paytoken =localStorage.phone;
        localStorage.payschool_id=localStorage.school_id;
        localStorage.examination_name = $("#examination_name").val();
        localStorage.examination_no_phone = $("#examination_no_phone").val();

        if(localStorage.examination_name == ""){
            layer.msg("姓名不能为空");
            return false;
        }
        if(localStorage.examination_no_phone == ""){
            layer.msg("电话不能为空");
            return false;
        }
         var phone = document.getElementById('examination_no_phone').value;
    if(!(/^1[34578]\d{9}$/.test(phone))){
        layer.msg("手机号码有误，请重填");
        return false;
    }
        if( $(".gouxuan").eq(0).css("display","block")){

             window.location.href='../payment/02/school_pay.html';
        }


    })
});


